package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.domain.LogiWaybillFee;

import java.util.List;

/**
 * 运单费用Mapper接口
 */
public interface LogiWaybillFeeMapper extends BaseMapperPlus<LogiWaybillFee> {

    default void updateByUK(LogiWaybillFee fee) {
        update(fee, Wrappers.<LogiWaybillFee>lambdaUpdate()
                .eq(LogiWaybillFee::getDeptId, fee.getDeptId())
                .eq(LogiWaybillFee::getWaybillId, fee.getWaybillId()));
    }

    default void removeByUK(Long deptId, Long waybillId) {
        delete(Wrappers.<LogiWaybillFee>lambdaQuery()
                .eq(LogiWaybillFee::getDeptId, deptId)
                .eq(LogiWaybillFee::getWaybillId, waybillId));
    }

    default List<LogiWaybillFee> selectByWaybillIds(List<Long> waybillIds) {
        return selectList(Wrappers.<LogiWaybillFee>lambdaQuery().in(LogiWaybillFee::getWaybillId, waybillIds));
    }
}
